package com.ly.sy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ly.sy.entity.Homework;
import com.ly.sy.entity.Video;
import com.ly.sy.mapper.HomeworkMapper;
import com.ly.sy.service.HomeworkService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liangyu
 * @since 2020-11-24
 */
@Service
public class HomeworkServiceImpl extends ServiceImpl<HomeworkMapper, Homework> implements HomeworkService {
    @Override
    public List<Homework> HomeworkBycourseId(Integer courseId) {
        QueryWrapper<Homework> wrapper = new QueryWrapper<>();
        wrapper.eq("course_id",courseId);
        List<Homework> CourseAndVideo = list(wrapper);
        return CourseAndVideo;
    }

    @Override
    public List<Homework> HomeworkBypAndCid(Integer courseId, Integer hwGroup) {
        QueryWrapper<Homework> wrapper = new QueryWrapper<>();
        wrapper.eq("course_id",courseId);
        wrapper.eq("hw_group",hwGroup);
        List<Homework> HomeWorkp = list(wrapper);
        return HomeWorkp;
    }

    @Override
    public List<Homework> homeworklikeLise(Integer searchstr, Integer courseId) {
        QueryWrapper<Homework> queryWrapper=new QueryWrapper<>();

        queryWrapper.eq("hw_group", searchstr);
        queryWrapper.eq("course_id", courseId);
        List<Homework> HomeworkFormSql= list(queryWrapper);
        return HomeworkFormSql;
    }
}
